# 第一种方式: try-except
try:
    num = 11
    print(11 / 0)
except:
    # 在真实的项目中,会将错误信息记录到日志文件中,log 方便后续的排查
    # print("程序报错了!")
    pass

# print("hello world")


# 第二种方式:(常用)
'''
try:
    num = 11
    print(11 / 0)
except Exception as e:
    print(e,type(e))

print("hehe")
'''
# 第三种方式: try-except-else
'''
try:
    num = 11
    print(num / 0)
except Exception as e:
    print("报错了,执行这里")
else:
    print("不报错执行这里")
'''

# 第四种方式: try-except-finally
try:
    num = 12
    print(num / 6)
except Exception as e:
    print("报错了走这里")
finally:
    print("不管你上面执行的是对和错,都来我这报道")

print("嘿嘿!")
